-
Notifications
You must be signed in to change notification settings - Fork 698
Fix: tenure downloader reward set error #6234 #6276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks for the clear comments!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! The comment made it way clearer :) I just left a couple of comments that you can feel free to just close them and merge
Co-authored-by: Francesco <2530388+Jiloc@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
fbb3ae6
Codecov ReportAttention: Patch coverage is
❌ Your project status has failed because the head coverage (77.96%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## develop #6276 +/- ##
===========================================
- Coverage 82.10% 77.96% -4.14%
===========================================
Files 546 546
Lines 347235 347462 +227
Branches 323 323
===========================================
- Hits 285088 270897 -14191
- Misses 62139 76557 +14418
Partials 8 8
... and 218 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
This PR refactors the reward cycle fetching logic in the tenure downloader and fixes the #6234 bug.
First -- I moved the
downloader_block_height_to_reward_cycle
method into a newly named (and commented) method thats a static method of the NakamotoDownloadStateMachine struct. The logic of that calculation is: given a block commit at burn height X, what is the latest possible reward cycle for a tenure the commit confirms?I think that the only places we want to use this calculation are in
WantedTenures
request generation -- basically, given a sortition tip, what tenures could we download and confirm?The bug in #6234 was caused by the fact that this calculation was also used for the reward set caching logic of the (unconfirmed) tenure downloader. This meant that for the first two tenures of a new reward cycle, the wrong reward sets would be used for download validation. The fix for this was to simply use the normal reward set calculation in those instances.
This PR adds an integration test for this behavior: basically, perform signer-set rollover with 2 active nodes. Importantly, in order for the test to actually cover the behavior, the nodes need to refuse block pushes (otherwise, they never need to use the TenureDownloader at all).